﻿using System.Data.Entity;
using System.Linq;
using Mondial2014.Models.Context;
using Mondial2014.Models.Monitoring;

namespace Mondial2014.Utils.Extensions
{
    public static class UpdateExtensions
    {
        public static IQueryable<FixtureResultUpdate> GetFixtureResultUpdates(this Mondial2014DbContext context)
        {
            return context.Updates.OfType<FixtureResultUpdate>()
                .Include(u => u.Fixture)
                .Include(u => u.Fixture.Team1)
                .Include(u => u.Fixture.Team2);
        }

        public static IQueryable<KnockoutUpdate> GetKnockoutUpdates(this Mondial2014DbContext context)
        {
            return context.Updates.OfType<KnockoutUpdate>()
                .Include(u => u.Team)
                .Include(u => u.Stage);
        }
    }
}